package com.qingcheng.controller.comment;

import com.alibaba.dubbo.config.annotation.Reference;
import com.qingcheng.entity.PageResult;
import com.qingcheng.entity.Result;
import com.qingcheng.pojo.comment.CommentEvaluation;
import com.qingcheng.service.comment.CommentEvaluationService;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("/commentEvaluation")
public class CommentEvaluationController {

    @Reference
    private CommentEvaluationService commentEvaluationService;

    @GetMapping("/findAll")
    public List<CommentEvaluation> findAll(){
        return commentEvaluationService.findAll();
    }

    @GetMapping("/findPage")
    public PageResult<CommentEvaluation> findPage(int page, int size){
        return commentEvaluationService.findPage(page, size);
    }

    @PostMapping("/findList")
    public List<CommentEvaluation> findList(@RequestBody Map<String,Object> searchMap){
        return commentEvaluationService.findList(searchMap);
    }

    @PostMapping("/findPage")
    public PageResult<CommentEvaluation> findPage(@RequestBody Map<String,Object> searchMap,int page, int size){
        return  commentEvaluationService.findPage(searchMap,page,size);
    }

    @GetMapping("/findById")
    public CommentEvaluation findById(String id){
        return commentEvaluationService.findById(id);
    }


    @PostMapping("/add")
    public Result add(@RequestBody CommentEvaluation commentEvaluation){
        commentEvaluationService.add(commentEvaluation);
        return new Result();
    }

    @PostMapping("/update")
    public Result update(@RequestBody CommentEvaluation commentEvaluation){
        commentEvaluationService.update(commentEvaluation);
        return new Result();
    }

    @GetMapping("/delete")
    public Result delete(String id){
        commentEvaluationService.delete(id);
        return new Result();
    }

}
